package com.hos.net.req.sms;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.hos.net.req.BaseReq;
import com.hos.net.res.MsgHint;
import com.hos.utile.StringUtile;

/**
 * Created by Administrator on 2018/8/24 0024.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class SmsReq extends BaseReq {
    public String phone;
    //1: 系统注册 2：系统找回密码  3：患者注册验证码 4：患者重置密码验证码
    //5：患者微信账号绑定手机号码
    //6：医生注册发送验证码  7：医生重置密码验证码
    public String type;

    @JsonIgnore
    public String hint;

    // (false 检验失败)
    @JsonIgnore
    public boolean isVerifyParameter(String type) {
        if (!StringUtile.isPhone(phone)) {
            hint = new MsgHint("请输入正确的手机号").toJson();
            return false;
        }
        if (this.type == null || this.type.equals("")) {
            hint = new MsgHint("验证码类型不能为空").toJson();
            return false;
        }
        if (!this.type.equals(type)) {
            hint = new MsgHint("验证码类型错误").toJson();
            return false;
        }
        return true;
    }

}
